package com.train.system.enums.impl;

import cn.hutool.core.util.ArrayUtil;
import com.train.system.enums.Enums;

import java.math.BigDecimal;

public enum SeatTypeEnums implements Enums {

    YDZ("1", "一等座", new BigDecimal("0.4")),
    EDZ("2", "二等座", new BigDecimal("0.3")),
    RW("3", "软卧", new BigDecimal("0.2")),
    YW("4", "硬卧", new BigDecimal("0.1"));

    private final String code;

    private final String message;

    private final BigDecimal price;

    SeatTypeEnums(String code, String message, BigDecimal price) {
        this.code = code;
        this.message = message;
        this.price = price;
    }

    public static SeatTypeEnums getByCode(String code) {
        return ArrayUtil.firstMatch(item -> item.getCode().equals(code), values());
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public BigDecimal getPrice() {
        return price;
    }
}
